<style lang="scss">
  /*每个页面公共css */
  @import "./assets/app.scss";
  @import "./uview-ui/index.scss";
  page{
    background: #f8f8f8;
  }
</style>
<script>

import store from '@/store'
import { getIsCheckStatus } from '@/api/system'
import { hideLoading, showLoading } from './common/fun'

export default {
  globalData: {
    showLoading: false
  },
  onLaunch: function () {
    console.log('App Launch')

    uni.$on('app-loading-close', () => {
      this.globalData.showLoading = false
      uni.hideLoading()
    })
    // 用来规范全局的toast使用
    uni.$on('app-loading-show', (title) => {
      if (this.globalData.showLoading) return
      this.globalData.showLoading = true
      uni.showLoading({
        title,
        mask: true
      })
    })
  },
  onShow: function (options) {
    console.log('App Show')

    getIsCheckStatus().then(res => {
      store.commit('system/SET_CHECK_STATUS', res.data)
    }).catch(err => { console.log(err) })
  },
  onHide: function () {
    console.log('App Hide')
  },
  onError: function (e) {
    console.log(e)
  }
}
</script>
